using System.Collections;
using UnityEngine;

internal class AngularVelocityCorrection : IPhysicalSupport
{
	private Rigidbody m_Rigidbody;

	private float m_Radius;

	private Vector3 m_Velocity;

	private Vector3 m_AngularVelocity;

	public void Init(Hashtable table)
	{
		m_Rigidbody = (Rigidbody)table["Rigidbody"];
		m_Radius = (float)table["Radius"];
	}

	public void FixedCall()
	{
		if (!m_Rigidbody.isKinematic)
		{
			m_Velocity = m_Rigidbody.velocity;
			m_AngularVelocity = PhysicalSupportTools.CalculateAngularVelocity(m_Radius, m_Velocity);
			if (m_Rigidbody.angularVelocity.sqrMagnitude <= m_AngularVelocity.sqrMagnitude)
			{
				m_Rigidbody.angularVelocity = m_AngularVelocity;
			}
		}
	}
}
